package com.asking.utils;

import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender;
import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.recommender.RecommendedItem;
import org.apache.mahout.cf.taste.similarity.ItemSimilarity;

import java.util.List;

public class MahoutUtil {

    public   static   List<RecommendedItem>     recommendedItem(DataModel dataModel, Long userId, Long itemID, Integer howMany) throws  Exception{
            ItemSimilarity    itemSimilarity = new PearsonCorrelationSimilarity(dataModel);
            //构建推荐器，协同过滤推荐有两种，分别是基于用户的和基于问题的，这里使用基于物品的协同过滤推荐
            GenericItemBasedRecommender recommender = new GenericItemBasedRecommender(dataModel, itemSimilarity);
            //给用户推荐若干个相似的问题
           // List<RecommendedItem> recommendedItemList = recommender.recommendedBecause(userId,itemID,howMany);
            return    null;
    }


}
